home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / Other Langs / Tickle-4.0 (tcl) / library / help / tcl / control / if < prev    next >
Encoding:
Text File  |  1993-10-26  |  1.3 KB  |  27 lines  |  [TEXT/$Tcl]

  1.  
  2.           if expr1 ?then? body1 elseif expr2 ?then? body2  elseif  ...
  3.           ?else? ?bodyN?
  4.  
  5.  
  6.      DESCRIPTION
  7.           The if command evaluates expr1 as an expression (in the same
  8.           way  that  expr  evaluates  its argument).  The value of the
  9.           expression must be a boolean (a numeric value,  where  0  is
  10.           false  and  anything is true, or a string value such as true
  11.           or yes for true and false or no for false); if  it  is  true
  12.           then body1 is executed by passing it to the Tcl interpreter.
  13.           Otherwise expr2 is evaluated as an expression and if  it  is
  14.           true  then  body2  is  executed,  and so on.  If none of the
  15.           expressions evaluates to true then bodyN is  executed.   The
  16.           then and else arguments are optional ``noise words'' to make
  17.           the command easier to read.  There  may  be  any  number  of
  18.           elseif  clauses,  including zero.  BodyN may also be omitted
  19.           as long as else is omitted too.  The return value  from  the
  20.           command  is the result of the body script that was executed,
  21.           or an empty string if none of the expressions  was  non-zero
  22.           and there was no bodyN.
  23.  
  24.  
  25.      KEYWORDS
  26.           boolean, conditional, else, false, if, true
  27.